﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using AnimalCare.Service;
using AnimalCare.Model;

namespace AnimalCare.View
{
    public partial class FormProductStatistics : DevExpress.XtraEditors.XtraForm
    {
        public FormProductStatistics()
        {
            InitializeComponent();
        }

        private void txtSearch_EditValueChanged(object sender, EventArgs e)
        {
            if (radioButton2.Checked)
            {
                gridControl.DataSource = ProductService.search(txtSearch.Text);
                gridControl.Refresh();
            }
        }

        private void FormProductStatistics_Load(object sender, EventArgs e)
        {
            AnimalCareDBEntities ad = new AnimalCareDBEntities();
            cbClass.DataSource = ad.Classifications;
            gridControl.DataSource = ProductService.search(txtSearch.Text);
            gridControl.Refresh();
        }

        private void label1_Click(object sender, EventArgs e)
        {
        }

        private void cbClass_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (radioButton1.Checked)
            {
                gridControl.DataSource = ProductService.search((Int32)cbClass.SelectedValue);
                gridControl.Refresh();
            }
        }
    }
}
